import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import ConfigElementType 1.0
import "qrc:/qmlComponents/ConfigManager"
import "qrc:/qmlComponents/AxisModulePos"
import "qrc:/qmlComponents/VisionViewer"
import "qrc:/qmlComponents/CustomizedUIElement"

ColumnLayout{
    spacing: 10

    RowLayout{
        id: xyzPosView
        XYZModulePos{
            moduleName: "BondHeadXYZ"
            posName: "StandbyPos"
        }
        XYZModulePos{
            moduleName: "BondHeadXYZ"
            posName: "UplookPos"
        }
    }
    RowLayout{
        SAxisModulePos{
            moduleName: "BondHeadMiniZ"
            posName: "StandbyPos"
        }
        SAxisModulePos{
            moduleName: "BondHeadZ"
            posName: "LTPickPlacePos"
        }
        SAxisModulePos{
            moduleName: "BondHeadZ"
            posName: "STPickPlacePos"
        }
        ColumnLayout{
            Button{
                text: qsTr("PickDut")
                onClicked: {
                    tem.runSingleCmd(bonderHead, "doPick")
                }
            }
            Button{
                text: qsTr("PlaceDut")
                onClicked: {
                    tem.runSingleCmd(bonderHead, "doPlace")
                }
            }
        }
    }

    Rectangle{
        width: 1000
        height: 10
        color: "pink"
    }

    MyTabView{
        indent: 2
        Component{
            id: bhOperationView
            BonderHeadOperationViewer{}
        }
        Component{
            id: setupView
            SetupViewer{}
        }
        Component{
            id: bhSafetyPosView
            SafetyPosView {}
        }
        Component{
            id: ltCaliGlassPrViewer
            LTCaliGlassPrViewer{}
        }
        Component{
            id: ltCalibrateViewer
            LTCalibrateViewer{}
        }
        Component{
            id: stCaliGlassPrViewer
            STCaliGlassPrViewer{}
        }
        Component{
            id: stCalibrateViewer
            STCalibrateViewer{}
        }
        Component{
            id: ltLensPrViewer
            LTLensPrViewer{}
        }
        Component{
            id: lensUplookPrViewer
            LensUplookPrViewer{}
        }
        Component{
            id: stensorPrViewer
            STSensorPrViewer{}
        }
        Component{
            id: twoDimensionCalibrationView
            TwoDimensionCalibrationView{}
        }

        Component.onCompleted: {
            addTab("Operation", bhOperationView)
            addTab("Setup", setupView)
            addTab("SafetyPos", bhSafetyPosView)
            addTab("LTLensPr", ltLensPrViewer, "LensTrayLensPr")
            addTab("LensUplookPr", lensUplookPrViewer)
            addTab("STSensorPr", stensorPrViewer, "SensorTraySensorPr")
            addTab("LTCaliGlassPr", ltCaliGlassPrViewer, "LensTrayCalibrationGlassPr")
            addTab("LTCalibrate", ltCalibrateViewer, "LensTrayCalibrate")
            addTab("STCaliGlassPr", stCaliGlassPrViewer, "SensorTrayCalibrationGlassPr")
            addTab("STCalibrate", stCalibrateViewer, "SensorTrayCalibrate")
            addTab("TwoDimCali", twoDimensionCalibrationView, "TwoDimensionCalibration")
        }
    }
}
